{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}

{% block title %}策略详情页{% endblock %}
{% block navbar %}
<nav class="navbar navbar-default navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
          <!-- The mobile navbar-toggle button can be safely removed since you do not need it in a non-responsive implementation -->
          <a class="navbar-brand" href="/">策略模拟回测</a>
        </div>
        <!-- Note that the .navbar-collapse and .collapse classes have been removed from the #navbar -->
        <div id="navbar">
          <ul class="nav navbar-nav">
            <li class="active"><a href="/">首页</a></li>
          </ul>
          <ul class="nav navbar-nav navbar-right">
            <li><a href="#">当前登录用户：{{current_user}}</a></li>
            <li><a href="{{url_for('logout', _external=True)}}">登出</a></li>
          </ul>
        </div><!--/.nav-collapse -->
    </div>
</nav>
<link href="/static/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="/static/css/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
{% endblock %}

{% block page_content %}
	<div class="page-content">

        <p>&nbsp;</p>
        <p>&nbsp;</p>

        {% for message in get_flashed_messages(with_categories=True) %}
            <div class="alert alert-{{ message[0] }}">
                {{ message[1] }}
            </div>
        {% endfor %}
        </div>

        <p><h3 align="center"><b>策略名称：{{ strategy_name }}</b></h3></p>
        <p><h4> &nbsp; </h4></p>
            {% if daily_updates %}
            <p><h3 align="center"> 策略内容 </h3></p>
            <hr size="2" />
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>序号</th>
                        <th>日期</th>
                        <th>股票代码</th>
                    </tr>
                </thead>
                <tbody>
                    {% for update in daily_updates %}
                    <tr>
                        <td>{{ loop.index0 + 1 }}</td>
                        <td>{{ update.date }}</td>
                        <td>{{ update.stockid }}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
            {% endif %}

            <p><h4> &nbsp; </h4></p>

            {% if daily_assets %}
            <p><h3 align="center"> 账户资产 </h3></p>
            <hr size="2" />
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>序号</th>
                        <th>日期</th>
                        <th>现金</th>
                        <th>持仓价值</th>
                        <th>总资产</th>
                    </tr>
                </thead>
                <tbody>
                    {% for record in daily_assets %}
                    <tr>
                        <td>{{ loop.index0 + 1 }}</td>
                        <td>{{ record.date }}</td>
                        <td>{{ record.cash }}</td>
                        <td>{{ record.holding }}</td>
                        <td>{{ record.asset }}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
            {% endif %}

            <p><h4> &nbsp; </h4></p>

            {% if trading_records %}
            <p><h3 align="center"> 交易记录 </h3></p>
            <hr size="2" />
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>序号</th>
                        <th>日期</th>
                        <th>证券代码</th>
                        <th>交易价格</th>
                        <th>交易数量</th>
                        <th>成交额</th>
                        <th>手续费</th>
                    </tr>
                </thead>
                <tbody>
                    {% for record in trading_records %}
                    <tr>
                        <td>{{ loop.index0 + 1 }}</td>
                        <td>{{ record.date }}</td>
                        <td>{{ record.stockid }}</td>
                        <td>{{ record.price }}</td>
                        <td>{{ record.amount }}</td>
                        <td>{{ record.trans }}</td>
                        <td>{{ record.fee }}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
            {% endif %}
    </div>

<script type="text/javascript" src="/static/js/jquery-1.8.3.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="/static/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/static/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
<script type="text/javascript" src="/static/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
{% endblock %}
